home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LTP_HexEditRoutine.c < prev    next >
C/C++ Source or Header  |  1996-08-22  |  2KB  |  93 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #ifdef DO_HEXHOOK
  15. ULONG SAVE_DS ASM
  16. LTP_HexEditRoutine(REG(a0) struct Hook *hook,REG(a2) struct SGWork *sgw,REG(a1) Msg msg)
  17. {
  18.     LayoutHandle *handle;
  19.     ObjectNode *node;
  20.     BOOL activate;
  21.  
  22.     switch(msg->MethodID)
  23.     {
  24.         case SGH_KEY:
  25.  
  26.             handle = hook->h_Data;
  27.  
  28.             if(sgw->IEvent->ie_Code == 0x5F && handle->HelpHook)
  29.             {
  30.                 sgw->Code        = 0x5F;
  31.                 sgw->Actions    = (sgw->Actions & ~SGA_BEEP) | SGA_END | SGA_USE;
  32.  
  33.                 LTP_AddHistory(sgw);
  34.  
  35.                 break;
  36.             }
  37.  
  38.             if(sgw->IEvent->ie_Code == CURSORUP || sgw->IEvent->ie_Code == CURSORDOWN)
  39.                 LTP_HandleHistory(sgw);
  40.  
  41.             activate = TRUE;
  42.  
  43.             if(GETOBJECT(sgw->Gadget,node))
  44.             {
  45.                 if(node->Type == INTEGER_KIND)
  46.                 {
  47.                     if(node->Special.Integer.LastGadget)
  48.                         activate = FALSE;
  49.  
  50.                     if(!LTP_ConvertNum((node->Min < 0),sgw->WorkBuffer,(LONG *)&sgw->StringInfo->LongInt))
  51.                     {
  52.                         sgw->EditOp        = EO_BADFORMAT;
  53.                         sgw->Actions    = SGA_BEEP;
  54.                     }
  55.  
  56.                     if(node->Special.Integer.ValidateHook)
  57.                     {
  58.                         if(!CallHookPkt(node->Special.Integer.ValidateHook,sgw,msg))
  59.                         {
  60.                             sgw->EditOp        = EO_BADFORMAT;
  61.                             sgw->Actions    = SGA_BEEP;
  62.                         }
  63.                     }
  64.                 }
  65.             }
  66.  
  67.             if(sgw->EditOp == EO_ENTER && !(sgw->IEvent->ie_Qualifier & QUALIFIER_SHIFT))
  68.             {
  69.                 if(activate && handle->AutoActivate)
  70.                     sgw->Actions |= SGA_NEXTACTIVE;
  71.  
  72.                 if(!(sgw->Actions & SGA_NEXTACTIVE))
  73.                     sgw->Code = '\r';
  74.             }
  75.  
  76.             if(sgw->Actions & SGA_END)
  77.                 LTP_AddHistory(sgw);
  78.  
  79.             /* Falls through to... */
  80.  
  81.         case SGH_CLICK:
  82.  
  83.             break;
  84.  
  85.         default:
  86.  
  87.             return(FALSE);
  88.     }
  89.  
  90.     return(TRUE);
  91. }
  92. #endif
  93.